const Sight = require("../models/Sight");

// 获取所有热门城市
exports.getHotSights = async (req, res) => {
  try {
    const sights = await Sight.findAll({
      where: {
        hot: true,
      },
    });
    res.json(sights);
  } catch (error) {
    console.log(error);
    res.status(500).send("Server Error");
  }
};

// 添加热门城市
exports.addHotSights = async (req, res) => {
  console.log(123);
  try {
    const { name, image } = req.body;
    const sight = await Sight.create({
      name,
      image,
      hot: true,
    });
    res.send({ success: true });
  } catch (error) {
    console.log(error);
    res.status(500).send("Server Error");
  }
};
